<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	template="../../templates/template-private.xhtml">

	<ui:define name="content">
		<h2>Consulta de Núcleo</h2>


		<h:form id="formPesquisa">

			<div class="informacoes-gerais"
				style="float: left; margin-bottom: 10px; width: 445px;">

				<p:outputLabel>Descrição <p:inputText
						style="width: 314px" maxlength="50" value="#{NucleoMB.descricao}" />
				</p:outputLabel>

			</div>

			<div id="submit-form-nucleo"
				style="clear: both; margin-bottom: 45px; position: relative; top: 10px; width: 537px;">
				<p:outputLabel>

					<p:commandButton update="formPesquisa"
						actionListener="#{NucleoMB.pesquisar()}" value="Pesquisar" />
				</p:outputLabel>
			</div>


			<p:dataTable styleClass="tabela" id="resultados" var="nucleo"
				emptyMessage="Resultado não encontrado!"
				value="#{NucleoMB.listaDeNucleos}">

				<p:column width="100" headerText="Código">
					<h:outputText value="#{nucleo.idNucleo}" />
				</p:column>

				<p:column headerText="Descrição">
					<h:outputText value="#{nucleo.descricao}" />
				</p:column>

				<p:column width="60" headerText="Ações">

					<p:commandButton value="Alterar" action="#{NucleoMB.prepararEdicao}" >
						<f:setPropertyActionListener target="#{NucleoMB.nucleo}" value="#{nucleo}" />
					</p:commandButton>
					<p:commandButton value="Excluir" onclick="confirmacaoExclusao.show()" >
						<f:setPropertyActionListener target="#{NucleoMB.nucleo}" value="#{nucleo}" />
					</p:commandButton>

				</p:column>

			</p:dataTable>

			<p:confirmDialog id="confirmacaoExclusao"
				message="Deseja realmente excluir esse núcleo?" showEffect="bounce"
				hideEffect="explode" header="Excluindo núcleo" severity="alert"
				widgetVar="confirmacaoExclusao">

				<p:commandButton value="Sim" update="formPesquisa"
					actionListener="#{NucleoMB.remover()}"
					oncomplete="confirmacaoExclusao.hide()" />
				<p:commandButton value="Não" onclick="confirmacaoExclusao.hide()"
					type="button" />

			</p:confirmDialog>

		</h:form>

	</ui:define>

</ui:composition>